Export OLE from Doors to a word report

To export an OLE from Doors to Word, I do as following:

 

I select the OLE and I put it in a file  ( I use: exportPicture(ole,filename , formatPNG))

 

I put the contain of the file into a stream and then into a buffer.( I use:  Stream inStream = read binary inFile) 

 

I use the function  "_BASE64"  to convert the content of the buffer to BASE64 .

 

Then I put the _BASE64 content into the XML script.

 

But it doesn't work..

Can you help me?.

 

Thank you.

////////////////////////////////////

This is my code:

 

void readBinaryFile(string NameFile, Buffer b)
{
Stream x = read (binary (NameFile))
char c
 
while(true)
{
x >> c
 
if (end x)
break
else { b += c}
 
}
close x
}

 

void CheckisOLE (Object obj)

{
EmbeddedOleObject ole
RichText rtf
string s = richTextWithOle obj."Object Text"
string filename
Buffer b = create()

 

for rtf in s do
{
if (rtf.isOle)
{
//Mémorisation des OLE sous forme d'image.
ole = rtf.getEmbeddedOle
string filename = "C:\\essai-rtfloop-.png"
print "Exporting " filename "\n"
exportPicture(ole,filename , formatPNG)
 
 
// Read the image content
readBinaryFile(filename, b)
string outpstr = ""
print "bufferB content is equal to:" b "\n"
outpstr = stringOf(b)

setempty b

print "outpstr content is equal to:" outpstr "\n" "\n" "\n"

 

//Coding the content on base64

string Encoded1 = ""
toBase64_(outpstr, Encoded1)
print "Encoded1 content is equal to:" Encoded1 "\n" "\n" "\n"
 
 
//displaying it on xml.
AddBuffer("<w:pict>")
AddBuffer("<w:binData w:name=\"wordml://03000001.png\" xml:space=\"preserve\">")
AddBuffer(Encoded1)
AddBuffer("</w:binData>")
AddBuffer("<v:shape>")
AddBuffer("<v:imagedata src=\"wordml://03000001.png\" o:title=\"\"/>")
AddBuffer("</v:shape>")
AddBuffer("</w:pict>")
 
}
 
 

.


Karray - Tue Sep 03 12:50:08 EDT 2013

Re: Export OLE from Doors to a word report
Karray - Wed Sep 04 07:29:26 EDT 2013

Could anyone answer for my question?

 

Thanks

Re: Export OLE from Doors to a word report
llandale - Wed Sep 04 13:17:54 EDT 2013

Don't post the same thing in multiple threads.

I don't know; but it seems to me:

  • Copy-paste will get the OLE into Word.  maybe setRichClip
  • You won't need to send the picture to a file and then read the file into a buffer and then send the buffer.

-Louie

Re: Export OLE from Doors to a word report
Karray - Wed Sep 04 13:54:57 EDT 2013

llandale - Wed Sep 04 13:17:54 EDT 2013

Don't post the same thing in multiple threads.

I don't know; but it seems to me:

  • Copy-paste will get the OLE into Word.  maybe setRichClip
  • You won't need to send the picture to a file and then read the file into a buffer and then send the buffer.

-Louie

Hi,
 
Thank you for your help.
 
I wanna  writes the OLE to a temporary file : errmess = exportPicture(ole,tempFilename, formatPNG), then reads the temporary file Stream inStream = read binary tempFileName, then converts the inStream to Base-64 encoding and writes it to the XML file.
 
But when I put the contain of the file into a stream and then into a buffer.I remark that the NULL characters ( contained in tempFilename) aren't transmitted to the Buffer. So the BASE64 coding will be incorrect.

 

 

 

 

 

 

Re: Export OLE from Doors to a word report
llandale - Wed Sep 04 16:21:29 EDT 2013

Karray - Wed Sep 04 13:54:57 EDT 2013

Hi,
 
Thank you for your help.
 
I wanna  writes the OLE to a temporary file : errmess = exportPicture(ole,tempFilename, formatPNG), then reads the temporary file Stream inStream = read binary tempFileName, then converts the inStream to Base-64 encoding and writes it to the XML file.
 
But when I put the contain of the file into a stream and then into a buffer.I remark that the NULL characters ( contained in tempFilename) aren't transmitted to the Buffer. So the BASE64 coding will be incorrect.

 

 

 

 

 

 

Don't know.  I'd try these things:

[] Try bypassing the "Stream" and read the entire file in one chunk:

  • buf += readFile(NameOfFile)

[] Perhaps this would work; use clipboard and no tempFile.

  • oleCopy(EmbeddedOleObject)
  • buf += stringOf(richClip())

[] Or just

  • oleRtf(EmbeddedOleObject, buf)

-Louie

Re: Export OLE from Doors to a word report
Karray - Thu Sep 05 05:20:57 EDT 2013

llandale - Wed Sep 04 16:21:29 EDT 2013

Don't know.  I'd try these things:

[] Try bypassing the "Stream" and read the entire file in one chunk:

  • buf += readFile(NameOfFile)

[] Perhaps this would work; use clipboard and no tempFile.

  • oleCopy(EmbeddedOleObject)
  • buf += stringOf(richClip())

[] Or just

  • oleRtf(EmbeddedOleObject, buf)

-Louie

Thanks for help;

I try all the possibilities but they doesn't work.

In fact: when I put the contain of the file into a stream and then into a buffer.I remark that the NULL characters ( contained in tempFilename) aren't transmitted to the Buffer. So the BASE64 coding will be incorrect.

can't I directly put le stream as parameter into _BASE64 function? 

 

Thank you for help.

Re: Export OLE from Doors to a word report
Karray - Thu Sep 05 17:23:08 EDT 2013

Karray - Thu Sep 05 05:20:57 EDT 2013

Thanks for help;

I try all the possibilities but they doesn't work.

In fact: when I put the contain of the file into a stream and then into a buffer.I remark that the NULL characters ( contained in tempFilename) aren't transmitted to the Buffer. So the BASE64 coding will be incorrect.

can't I directly put le stream as parameter into _BASE64 function? 

 

Thank you for help.

Can you help me?

I am Blocked

:)

Than you.